
import pygame
from hexconfig import *

pygame.init()

print "Yo, sup?"
clock = pygame.time.Clock()
clock.tick()
screen = pygame.display.set_mode((SWIDTH,SHEIGHT))#,pygame.FULLSCREEN)#,pygame.HWSURFACE)

dh = DataHandler()


ds = dh.autoLoadDataSet()#
node = ds.getNode(WIN_NODE_STRING)

print node
#for edge in node.inEdges():
    #print ds.edges[edge]

total = 0

for nodeKey in ds.nodes.keys():

    node = ds.getNode(nodeKey)
    if node.util() != 0.0:
        print node
    continue
    for edgeString in node.outEdges():
        if edgeString == node.stateString()+WIN_NODE_STRING:
            print ds.edges[node.stateString()+WIN_NODE_STRING]
            total += 1

#print "Win edges:",total

    

print "Nodes:",len(ds.nodes.keys())
print "NodeGroups:",len(ds.nodes.nodeGroups.keys())
print "Edges:", len(ds.edges.keys())

exit()

ds.fleshOutEdges()

dh.autoSaveDataSet(ds)
exit()

"""


saveStep = 5.0
loadBar = 0
nodenumber = 0
nextSave = 0.0+saveStep
keys = ds.nodes.keys()
for key in keys:

    print "Node", nodenumber, ":",
    nodenumber += 1
    node = ds.nodes[key]
    if node.isLeaf == True:
        ds.spreadStateNode(node, 0)
        print "was spread",
    else:
        print "was not spread",
    percent = (1.0*nodenumber)/(1.0*len(keys))*100.0
    print percent, "%"
    if percent >= nextSave:
        dh.autoSaveDataSet(ds)
        nextSave += saveStep

dh.autoSaveDataSet(ds)
"""
